﻿using BussinessEntity;
using DataAccessLayer;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Utilities;

namespace BussinessLayer
{
    public class ImportManager
    {
        private static ImportDA adapter = new ImportDA();

        public static ActionResult<Import> Insert(Import entity)
        {
            return adapter.Insert(entity);
        }

        public static ActionResult<Import> Update(Import entity)
        {
            return adapter.Update(entity);
        }

        public static ActionResult<Import> Delete(string MaDV)
        {
            return adapter.Delete(MaDV);
        }

        public static ActionResult<Import> GetAll()
        {
            return adapter.GetAll();
        }


        public static ActionResult<Import> GetSingle(string MaPN)
        {
            return adapter.GetSingle(MaPN);
        }

        public static string NextID()
        {
            return adapter.NextID();
        }

        public static long Total(List<ImportDetail> list)
        {
            long t = 0;
            foreach (var item in list)
                t += item.Quantity * item.UnitPrice;
            return t;
        }
    }
}
